The "native" granular unit of OPC UA PubSub data delivery is a dataset message. The dataset message can contain values of multiple fields. All these field values belong together - they represent a snapshot of some state of the system at a common time point. Individual fields can then be extracted from the dataset message as needed.
There are, however, situations in which your code is only interested in a specific field (or specific fields) of the dataset. For such cases, OPC Data Client offers you a mechanism that allows you to subscribe to individual dataset fields, and the field extraction will be made for you by the component.
Subscribing to specific dataset fields is very similar to subscribing to the whole datasets. A subscription to a single dataset field is initiated by a call to SubscribeDataSetField Method. This is an extension method, with multiple overloads. The primary form takes an argument that is an instance of EasyUASubscribeDataSetFieldArguments Class. This class is very similar to the EasyUASubscribeDataSetArguments Class, but it has an additional DataSetFieldDescriptor Property, which specifies the name of the dataset field to be subscribed to, or its dataset field Id (a GUID; this only works if metadata is available). There are implicit conversions from a string (representing the field name) or a GUID (representing the dataset field Id) to the UADataSetFieldDescriptor Class contained in this property, so you usually do not have to construct the dataset field descriptor in your code explicitly.
The are various overloads of the SubscribeDataSetField Method, and also various overloads of the EasyUASubscribeDataSetFieldArguments Constructor that allow you to make your subscription code shorter, depending on which pieces of information needed for the subscription you have at hand.
The SubscribeDataSetField Method(s) return an integer (dataset) field subscription handle. Call the UnsubscribeDataSetField Method, passing it this field subscription handle, in order to unsubscribe from the dataset field.
Note that as usual, both the SubscribeDataSetField Method a UnsubscribeDataSetField Method operate asynchronously. That is, you may start receiving callbacks before the SubscribeDataSetField Method returns, and there may be some final callbacks made even after the UnsubscribeDataSetField Method returns.
The callback that you pass in is of type EasyUADataSetFieldMessageEventHandler Delegate, and carries with it event arguments of type EasyUADataSetFieldMessageEventArgs Class. This class is very similar to the EasyUADataSetMessageEventArgs Class, except that instead of the data for the whole dataset message, it contains only data for the particular dataset field that you have subscribed to, in its FieldData Property. Successful establishment of a PubSub connection is indicated by a callback event arguments in which both the Exception Property and FieldData Property contain a null reference.
If you just need a specific dataset field, the code becomes simpler with the use of single-field subscriptions. Also, there is no big performance penalty: Even if you subscribe to multiple dataset fields using this mechanism, internally, OPC Data Client makes just one PubSub connection to the message oriented middleware, and also all the message parsing, filtering and most of the processing is made just once. It is only the final message delivery steps that are split, and different.
The disadvantages related to the use of subscriptions to specific dataset fields are: